<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="utf-8">
	<title>修改密码</title>
	<script type="application/javascript" src="/static/js/common.js"></script>
</head>


<body>
	<nav class="nav">
		<a class="button button-link left" onclick="history.back();">
			<svg class="icon" aria-hidden="true">
				<use xlink:href="#icon-fanhui-"></use>
			</svg>返回
		</a>
		<a class="button button-link right" onclick="history.go(0);">
			<svg class="icon" aria-hidden="true">
				<use xlink:href="#icon-zhuanfa-"></use>
			</svg>刷新
		</a>
		<h1 class="title">修改密码</h1>
	</nav>
	<header class='app-header'>
		<h1 class="app-title">修改密码</h1>
	</header>
	<div class="app-content">
		<div class="weui-panel weui-panel_access">
			<div class="weui-panel__bd">
				<form id="bookInputForm" class="weui-cells weui-cells_form">
					<div class="weui-loadmore weui-loadmore_line">
						<span class="weui-loadmore__tips">修改之前请注意：记好自己的密码，不然没人找得回来！</span>
					</div>
					<div class="weui-cell">
						<div class="weui-cell__hd">
							<label class="weui-label">原密码</label>
						</div>
						<div class="weui-cell__bd">
							<input class="weui-input" type="password" name="oldPassword" >
						</div>
					</div>
					<div class="weui-cell">
						<div class="weui-cell__hd">
							<label class="weui-label">新密码</label>
						</div>
						<div class="weui-cell__bd">
							<input class="weui-input" type="password" name="password" >
						</div>
					</div>
					<div class="weui-cells__tips">当前修改人：<span th:text="${account.userName}"></span></div>
					<br/>
					<a href="javascript:;" id="bookInputSubmit" class="weui-btn weui-btn_primary">确认修改</a>
				</form>
			</div>

		</div>
	</div>

<script type="application/javascript">

	//提交表单
	APP.submitAction($("#bookInputSubmit"), function (item) {
		const field = APP.getFormValue($("#bookInputForm"));
		APP.ajaxSubmit("/setting/changePassword", field, function (res) {
			APP.ajaxRes(res, function (uuid) {
				$.toast("操作成功");
                location.href = "/login";
			}, function (msg) {
				$.toast(msg, "forbidden");
				APP.disabled(item);
			})
		})
	});

</script>
</body>

</html>
